package com.lc1993929.secret.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by LiuChang on 2017/5/12.
 */
@Controller
@RequestMapping("/test")
public class TestController {

    @RequestMapping("/test")
    public String test() {
        return "success";
    }

    @RequestMapping("/io")
    @ResponseBody
    public String io(String action) {
        if (action.equals("send_pass")) {
            return "{\"status\":1}";
        } else if (action.equals("login")) {
            return "{\"status\":1,\"token\":\"123456\"}";
        } else if (action.equals("upload_contacts")) {
            return "{\"status\":1}";
        } else if (action.equals("timeline")) {
            return "{\"status\":1,\"page\":1,\"perpage\":20,\"timeline\":[" +
                    "{\"msg\":\"Haha\",\"phone_md5\":\"asdfasdf\",\"msgId\":\"123213\"}," +
                    "{\"msg\":\"Haha2\",\"phone_md5\":\"asdfasdf2\",\"msgId\":\"1232132\"}," +
                    "{\"msg\":\"Haha3\",\"phone_md5\":\"asdfasdf3\",\"msgId\":\"1232133\"}," +
                    "{\"msg\":\"Haha4\",\"phone_md5\":\"asdfasdf3\",\"msgId\":\"1232133\"}," +
                    "{\"msg\":\"Haha5\",\"phone_md5\":\"asdfasdf3\",\"msgId\":\"1232133\"}," +
                    "{\"msg\":\"Haha6\",\"phone_md5\":\"asdfasdf3\",\"msgId\":\"1232133\"}," +
                    "{\"msg\":\"Haha7\",\"phone_md5\":\"asdfasdf3\",\"msgId\":\"1232133\"}," +
                    "{\"msg\":\"Haha8\",\"phone_md5\":\"asdfasdf3\",\"msgId\":\"1232133\"}" +
                    "]}";
        } else if (action.equals("get_comment")) {
            return "{\"status\":1,\"page\":1,\"perpage\":20,\"msgId\":\"123\",\"comments\":[" +
                    "{\"content\":\"Hehe\",\"phone_md5\":\"asdfasdf\"}," +
                    "{\"content\":\"Hehe2\",\"phone_md5\":\"asdfasdf2\"}," +
                    "{\"content\":\"Hehe3\",\"phone_md5\":\"asdfasdf3\"}," +
                    "{\"content\":\"Hehe4\",\"phone_md5\":\"asdfasdf3\"}," +
                    "{\"content\":\"Hehe5\",\"phone_md5\":\"asdfasdf3\"}," +
                    "{\"content\":\"Hehe6\",\"phone_md5\":\"asdfasdf3\"}," +
                    "{\"content\":\"Hehe7\",\"phone_md5\":\"asdfasdf3\"}," +
                    "{\"content\":\"Hehe8\",\"phone_md5\":\"asdfasdf3\"}" +
                    "]}";
        } else if (action.equals("pub_comment")) {
            return "{\"status\":1}";
        } else if (action.equals("publish")) {
            return "{\"status\":1}";
        } else {
            return "请指定action";
        }
    }

}
